package com.youpingou.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseResult {

    private Integer code;
    private String message;
    private Object data;
//    private String token;


    public BaseResult(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    public static BaseResult ok(){
        return new BaseResult(0,"成功");
    }
    public static BaseResult ok(String message, Object data){
        return new BaseResult(0,message,data);
    }

    public static BaseResult ok(Object data) {
        return new BaseResult(0,"成功",data);
    }

    public static BaseResult error(String message, Object data){
        return new BaseResult(1,message,data);
    }
    public static BaseResult error(String message){
        return new BaseResult(1,message);
    }
    public static BaseResult error(){
        return new BaseResult(1,"失败");
    }
}

